<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>护士信息</title>
    <link rel="stylesheet" href="css/bootstrap.css">
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/bootstrap.js" type="text/javascript"></script>
    <script src="js/jsrender.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function(){
            if(localStorage.getItem("token")==null){
                window.location.href="login.html"
            }
            if(localStorage.getItem("userId")!=null){
                $("#userid").val(localStorage.getItem("userId"))
                localStorage.removeItem("userId")
            }
            $("form").submit(function(){
                $.ajax({
                    url: GC.bctx + "nurse/insert",
                    type:"POST",
                    data:$("form").serialize(),
                    headers: {"Authorization": localStorage.getItem("token")},
                    success:function(r){
                        if(r.successed){
                            //修改成功，转向显示所有部门页面
                            alert(r.message)
                            window.location.href="nurses.html"
                        }else{
                            //修改失败，显示失败信息
                            alert(r.message)
                        }

                    }
                })
                return false
            })
        })
    </script>
</head>
<body>
<div class="container-fluid">
    <h1>护士信息</h1>
    <hr/>
    <form>
        <table>
            <tr class="d-none">
                <td >护士id</td>
                <td><input id="nurseid" name="nurseid" type="text"/></td>
                <td><span class="c-r">*</span></td>
            </tr>
            <tr>
                <td>用户id</td>
                <td><input id="userid" name="userid"  type="text"/></td>
                <td><span class="c-r">*</span></td>
            </tr>
            <tr >
                <td >护士姓名：</td>
                <td><input id="nursename" name="nursename" type="text"/></td>
                <td><span class="c-r">*</span></td>
            </tr>
            <tr>
                <td>护士性别：</td>
                <td><select id="nursesex" name="nursesex" readonly="true">
                    <option value="男">男</option>
                    <option value="女">女</option>
                </select></td>
                <td><span class="c-r">*</span></td>
            </tr>
            <tr>
                <td>护士年龄：</td>
                <td><input id="nurseage" name="nurseage" type="text"/></td>
                <td><span class="c-r">*</span></td>
            </tr>
            <tr>
                <td colspan="3" class="text-center">
                    <input type="submit" value="新建"/>
                    <input type="reset" value="重置"/>
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>